<?php
use yii\helpers\Url;
use yii\widgets\ActiveForm;
use yii\helpers\Html;
?>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <link rel="icon" href="images/icon.png">
    <title>注册</title>
    <link href="/styles/reset.css" rel="stylesheet" type="text/css">
    <link href="/styles/bootstrap.css" rel="stylesheet" type="text/css">
    <link href="/styles/register.css" rel="stylesheet" type="text/css">
    <script src="/js/jquery-1.11.1.js"></script>
</head>
<body>
<html>
<script type="text/javascript">
    //验证码刷新的操作
    function refreshCaptcha(){
        $.getJSON("<?php echo Url::toRoute(['site/captcha','refresh'=>true])?>",function(res){
            var _captcha = $('#VerifyCodeIcon'); //选择图片
            var dataUrl = _captcha.attr("data-url");
            if(!dataUrl){
                dataUrl = _captcha.attr("src");
                _captcha.attr("data-url",dataUrl);
            }
            _captcha.attr("src",dataUrl+"?rd="+Math.random());
        });
    }
</script>
<head></head>
<div class="total rows">
    <div class="regiPart">
        <div class="container">
            <div class="col-lg-6 col-lg-offset-3 mainPart">
                <div class="regiIcon">
                    <img src="/images/myHair.png" alt="好头发" />
                </div>
                <div class="regiTextBox col-lg-12">
                    <div class="col-lg-8 col-lg-offset-2">
                        <?php $form = ActiveForm::begin(['id' => 'regiForm','options' => ['class' => 'regiForm']]); ?>
                        <fieldset>
                            <p class="legend">欢迎加入我的发</p>
                            <?= $form->field($model, 'username',['options'=>['id'=>'ceilPhoneNum']])->textInput()
                                ->label(false)->textInput(['placeholder' => '手机号'])->error(['class'=>'error']) ?>
                            <?= $form->field($model,'code',['options'=>['class'=>'form-group'],'template'=>'{input}'])->widget(yii\captcha\Captcha::className(),[
                                'options' => ['class'=>'col-lg-8','placeholder' => '验证码','id' => 'verifyCode'],
                                'template' => '{input}<a onclick="refreshCaptcha();">{image}</a>',
                                'imageOptions' => ['class'=>'col-lg-3','id'=>'VerifyCodeIcon','title'=>'换一个', 'alt'=>'换一个', 'style'=>'cursor:pointer;'],
                                'captchaAction'=> Url::toRoute('site/captcha')
                            ])?>
<!--                            <div class="form-group"><input id="ceilVerifyCodeBtn" type="button" value="获取手机验证码" /></div>-->
<!--                            <div class="form-group"><input id="ceilVerifyCode" name="ceilVerifyCode" placeholder="手机验证码" /></div>-->
                            <?= $form->field($model, 'nic_name')->textInput()->label(false)->textInput(['placeholder' => '昵称'])->error(['class'=>'error']) ?>
                            <?= $form->field($model, 'password')->passwordInput()->label(false)->textInput(['placeholder' => '密码'])->error(['class'=>'error']) ?>
                            <div class="form-group">
                                <?= Html::submitButton('注册', ['id' => 'registerBtn']) ?>
                            </div>
                            <p class="service">点击注册表示同意我的发<a href="#">《服务条款》</a></p>
                        </fieldset>
                        <?php ActiveForm::end(); ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="text-right">
        已有账号?
        <a href="<?=Url::toRoute('site/login')?>">登录</a>
    </div>
    <div class="logTextBox" >
        <form class="logForm" id="logForm" method="get" action="#">
            <fieldset>
                <p class="legend">欢迎登录我的发</p>
                <p><input id="logPhone" class="phone" name="phone" placeholder="手机号" /></p>
                <p><input id="logPassword" class="password" name="password" type="password" placeholder="密码" /></p>
                <p class="autoLogin"><input id="autoLogin" type="checkbox" value="登录" /><span class="autoLoginLeft">自动登录</span><span class="autoLoginRight"><a href="#">忘记密码？</a></span></p>
                <p><input id="loginBtn" type="submit" value="登录" /></p>
                <p class="noAccount">还没有账号？<a href="#">现在注册</a></p>
            </fieldset>
        </form>
    </div>
</div>
</body>
</html>